layui.use(['jquery','layer','form','table','laydate','upload'],function() {
   var $ = layui.$, layer = layui.layer, form = layui.form, table = layui.table, laydate = layui.laydate, upload = layui.upload;

    laydate.render({
        elem: '#entranceDate'
    });

    laydate.render({
        elem: '#graduationDate'
    });

    //获取当前时间
    var myDate = new Date();
    var myYear = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
    var myMonth = myDate.getMonth()+1; //获取当前月份(0-11,0代表1月)
    var myToday = myDate.getDate(); //获取当前日(1-31)
    var myDay = myDate.getDay(); //获取当前星期X(0-6,0代表星期天)
    var myHour = myDate.getHours(); //获取当前小时数(0-23)
    var myMinute = myDate.getMinutes(); //获取当前分钟数(0-59)
    var mySecond = myDate.getSeconds(); //获取当前秒数(0-59)
    var newTime = myYear+'-'+myMonth+'-'+myToday+' '+myHour+':'+myMinute+':'+mySecond;

    $('input[name=createDate]').val(newTime);
    $('input[name=updateDate]').val(newTime);

    var userId = parent.$('#userId').val();
    //根据id查询用户 22/1/13
    $.ajax({
        url: '/user/getUsers'
       ,data: {'userId': userId}
       ,dataType: 'json'
       ,success:function(data){
            $('#account').val(data.data[0].account);
            $('#nickname').val(data.data[0].nickname);
            $('#fullName').val(data.data[0].fullName);
            $('#userCode').val(data.data[0].userCode);
       }
    });

    form.on('submit(sub)',function(data){
        var user = data.field;
        console.log(user);
        $.ajax({
            url: '/user/addJinsiUsers'
            ,data: {
                'createDate': user.createDate
                ,'createId': user.createId
                ,'entranceDate': user.entranceDate
                ,'graduationDate': user.graduationDate
                ,'integration': user.integration
                ,'profession': user.profession
                ,'remarks': user.remarks
                ,'type': user.type
                ,'updateDate': user.updateDate
                ,'updateId': user.updateId
                ,'studyContent': user.studyContent
                ,'userId': userId
            }
            ,dataType: 'json'
            ,success:function(data){
                var layer = parent.layer;
                layer.close(layer.index);
                layer.msg('成功将此用户添加为进思用户');
            }
        });

    });


//取消 赵 22/1/14
cancel = function cancel(){
    var layer = parent.layer;
    layer.close(layer.index);
}












});